var $places={
	xpcom:function(type){
		switch (type) { 
			case "tag": 
				return Components.classes["@mozilla.org/browser/tagging-service;1"].getService(Components.interfaces.nsITaggingService);
			default:
				return Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Components.interfaces.nsINavBookmarksService);
		}
	},
	objUri:function(uri){
		return Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(uri, null, null);
	},
	tag:{
		add:function(uri,tag){
			var obj=$places.xpcom("tag");
			obj.tagURI($places.objUri(uri), tag);
		},
		get:function(uri){
			var obj=$places.xpcom("tag");
			return obj.getTagsForURI($places.objUri(uri), {});
		},
	}
}
